package com.fangsheng.customstart.config;



import com.fangsheng.customstart.entity.WelProperties;
import com.fangsheng.customstart.service.WelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/*
 * 定义自动装配类，并将我们我们的业务类实例化置于容器中
 * */
@Configuration    //指定这个类是一个配置类
@ConditionalOnWebApplication     //web应用才生效
@EnableConfigurationProperties(value = WelProperties.class)  //让UserProperties生效加入到容器中
public class WelConf {

    @Autowired
    WelProperties welProperties;


    @Bean
    public WelService getWelService(){

        WelService welService = new WelService();
        welService.setWelProperties(welProperties);
        return welService;
    }


}
